<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
String path = request.getContextPath(); 
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>"> 
<meta charset="UTF-8">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">  
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="css/edittable.css"  ></link>  
<link rel="stylesheet" type="text/css" href="css/validate.css"  ></link>  
<script type="text/javascript"  src="js/jquery-1.8.0.js"></script>
<script >
var reg = /^[^\s]{2,15}$/;
function validate() {
	if ($("#roleName").val() == "" || $.trim($("#roleName").val()).length == 0) {
		document.getElementById("roleName_msg").style.color = "#ff0000";
	    document.getElementById("roleName_msg").innerHTML = "角色名不能为空!";
	    return false;
	}else if (reg.test($("#roleName").val()) === false) {
		document.getElementById("roleName_msg").style.color = "#ff0000";
	    document.getElementById("roleName_msg").innerHTML = "角色名不合格，请输入\"2-15位非空白字符\"";
	    return false;
	}else{
		result = confirm("确定要提交吗?");
        return result;
	}
}
</script>
</head>
<body>
	<div class ="div_title">
			 <div class="div_titlename"> <img src="images/san_jiao.gif" ><span>角色添加</span></div>
	</div>
	<form action="AddroleServlet.do" onsubmit="return validate()" method="post">
		<table class="edit_table" >
		<tr>
 			 	<td class="td_info">角色名称:</td>	
 			 	<td class="td_input_short"> 
 			 		<input type="text" class="txtbox" id="roleName" name="roleName" /> 
 			 	</td>   
 			 	<td>
 			 		<label class="validate_info" id="roleName_msg">2-15位非空白字符</label>
 			 	</td> 
 		</tr>
 		<tr>
 			<td class="td_info">角色描述:</td>	
 			<td><textarea rows="4" cols="27" name="des" class="txtarea" ></textarea> </td>	
 			<td><label></label></td>	
 		</tr>
 		<tr>
 			<td class="td_info"> </td>	
 			<td> 
 			<input class="form_btn" type="submit" value="提交" /> 
 			<input type="reset"  class="form_btn" value="重置" /> </td>	
 			<td>
 				<label id="result_msg" class="result_msg">${msg}</label>
 			</td>	
 		</tr>
		</table>
	</form>
</body>
</html>